//package com.dlz.systemshop.config;
//
//import com.dlz.systemshop.interceptor.MyInterceptor;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.web.servlet.config.annotation.CorsRegistry;
//import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
//import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
//
//@Configuration
//public class WebConfig implements WebMvcConfigurer {
//
//
//    @Autowired
//    private MyInterceptor myInterceptor;
//
//    @Override
//    public void addCorsMappings(CorsRegistry registry) {
//        registry.addMapping("/**")  指定允许跨域的路径
//                .allowedOrigins("http://localhost:5173/") 允许的源
//                .allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS") 允许的HTTP方法
//                .allowedHeaders("*") 允许的请求头
//                .allowCredentials(true) 是否允许发送Cookie
//                .maxAge(3600); 预检请求的有效期
//    }
//
//    @Override
//    public void addInterceptors(InterceptorRegistry registry) {
//        registry.addInterceptor(myInterceptor)
//                .addPathPatterns("/**") // 拦截所有路径
//                .excludePathPatterns("/admin/login","/login"); // 排除某些路径
//    }
//}这是什么？
//

